﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.WebApiTool
{
    public class DModule
    {
        public List<DScenario> ScenarioList { get; set; }

        public string Name { get; set; }
        public Assembly Assembly { get; set; }

        public DModule(string name)
        {
            Name = name;
            ScenarioList = new List<DScenario>();
        }

        public DScenario GetOrCreate(string name)
        {
            for (int index = 0; index < ScenarioList.Count; index++)
            {
                if(string.Equals(ScenarioList[index].Name, name, StringComparison.CurrentCultureIgnoreCase))
                {
                    return ScenarioList[index];
                }
            }

            DScenario scenario = new DScenario(name);
            ScenarioList.Add(scenario);
            return scenario;
        }
    }
}
